package com.xyf.sys.service.impl;

import com.xyf.sys.domain.RegimentAssistItem;
import com.xyf.sys.mapper.RegimentAssistItemMapper;
import com.xyf.sys.service.IRegimentAssistItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author R-H
 * @Date 2024/6/241616
 * @Description
 */
@Service
public class RegimentAssistItemServiceImpl implements IRegimentAssistItemService {

    @Autowired
    private RegimentAssistItemMapper mapper;

    @Override
    public int insert(RegimentAssistItem assistItem) {
        assistItem.setStatus("0");
        assistItem.setDelFlag("0");
        assistItem.setCreateTime(new Date());
        assistItem.setLastUpdateTime(new Date());
        return mapper.insert(assistItem);
    }

    @Override
    public List<RegimentAssistItem> getList(Long assistId) {
        return mapper.selectByAssistId(assistId);
    }

    @Override
    public RegimentAssistItem get(Long assistId, String userId) {
        return mapper.selectByAssistIdAndUserId(assistId, userId);
    }

    @Override
    public void update(RegimentAssistItem assistItem) {
        mapper.updateByPrimaryKeySelective(assistItem);
    }
}
